package com.action;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.config.PrimaryGenerater;
import com.dto.Activity;
import com.service.ActivityService;

import ch.qos.logback.classic.Logger;

@RestController
@RequestMapping("ActivityAction")
public class ActivityAction {
	@Autowired
	private  ActivityService as;
	@Autowired
	private   PrimaryGenerater  pg;
	/**
	 * @时间2018年4月19日
	 * @作者:唐文亭
	 * 说明:获取活动编号
	 */
	@RequestMapping("queryNumber.do")//得到活动编号
	public ModelAndView queryNumber(HttpSession session) {
		
		String bianhao=pg.toDateString();
		session.setAttribute("bianhao", bianhao);
		
		return new ModelAndView("forward:/ActivityManage.jsp");
	}
	/**
	 * @时间2018年4月19日
	 * @作者:唐文亭
	 * 说明:添加活动
	 */
	@RequestMapping("addActivity.do")//添加活动
	public ModelAndView addActivity(Activity activity) {
		as.addActivity(activity);
		return new ModelAndView("forward:/HTManager.jsp");
	}
	/*@Scheduled(cron="0 30 11 * * ?" )
	public void deleteActivity(Activity activity) {
		String ids="872897C6D4724DD59D5D23B63D5E7DFF";
		activity.setA_id(ids);
		as.timingDeleteActivity(activity.getA_id());
		System.out.println("delete完成");
	}*/
}
